package com.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
@Data
@NoArgsConstructor()
@TableName("order_items")
public class OrderItems {
    //CREATE TABLE order_items (
    //    id INT AUTO_INCREMENT PRIMARY KEY,
    //    order_id VARCHAR(32) NOT NULL,
    //    product_id INT NOT NULL COMMENT '商品ID',
    //    quantity INT NOT NULL COMMENT '购买数量',
    //    unit_price DECIMAL(10,2) NOT NULL COMMENT '成交单价',
    //    subtotal DECIMAL(12,2) GENERATED ALWAYS AS (quantity * unit_price) COMMENT '小计金额'
    //) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    @TableId(type= IdType.AUTO)
    private Integer id;
    private String order_id;

    private Integer product_id;
    private Integer quantity;
    private BigDecimal unit_price;

    private BigDecimal subtotal;


}
